<cfcomponent name="ticketServiceAdvice" extends="coldspring.aop.AfterReturningAdvice">

  <!--- setters for dependencies --->
  <cffunction name="setTicketService" returntype="void" access="public" output="false" hint="Dependency: security service">
    <cfargument name="ticketService" type="any" _type="actionpacks.logger.service.TicketService" required="true"/>
    <cfset variables.m_ticketService = arguments.TicketService />
  </cffunction>

  <cffunction name="getTicketService" returntype="any" _returntype="actionpacks.logger.service.TicketService" access="public" output="false" hint="Dependency: security service">
    <cfreturn variables.m_ticketService />
  </cffunction>

  <!--- afterReturning() is called by the aop framework after method invocation --->
	<cffunction name="afterReturning" access="public" returntype="any">
		<cfargument name="returnVal" type="any" required="false" />
		<cfargument name="method" type="coldspring.aop.Method" required="true" />
		<cfargument name="args" type="struct" required="true" />
		<cfargument name="target" type="any" required="true" />
			<cfset var retDump = "" />
			<cfset var msg = "" />
			<cfset var arg = "" />
			<cfset var argString = "" />
			<cfset var objName = getMetadata(arguments.target).name />
			<cfset var hasRet = StructKeyExists(arguments,"returnVal")>
			<cfloop collection="#arguments.args#" item="arg">
				<cfif isSimpleValue(arguments.args[arg])>
					<cfif len(argString)>
						<cfset argString = argString & ', ' />
					</cfif>
					<cfset argString = argString & arg & '=' & arguments.args[arg] >
				</cfif>
			</cfloop>
			<cfsavecontent variable="retDump">
				<cftry><cfdump var="#xmlParse(GetHttpRequestData().content)#"><cfcatch><cfdump var="#GetHttpRequestData().content#"></cfcatch></cftry>
				<cfdump var="#arguments.returnVal#">
			</cfsavecontent>
			<cfquery name="addLog" datasource="projects">
				INSERT INTO xmlrpclog (logMessage<cfif hasRet>,logDetail</cfif>)
				VALUES ('[#objName#] #method.getMethodName()# (#argString#) returned!'<cfif hasRet>,'#retDump#'</cfif>)
			</cfquery>
	</cffunction>

</cfcomponent>










